<!DOCTYPE html>
<html class="x-admin-sm" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>网关配置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" th:href="@{/public/plugins/xadmin/css/font.css}">
    <link rel="stylesheet" th:href="@{/public/plugins/xadmin/css/xadmin.css}">
    <script th:src="@{/public/plugins/xadmin/lib/layui/layui.js}"></script>
    <script th:src="@{/public/plugins/xadmin/js/xadmin.js}"></script>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row">
        <fieldset class="layui-elem-field layui-field-title">
        <legend>基本信息</legend>
        </fieldset>
        <form class="layui-form">
            <input type="hidden" name="id" th:value="${route.id}">
            <div class="layui-form-item">
                <label for="routeId" class="layui-form-label">
                    <span class="x-red">*</span>路由Id
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="routeId" name="routeId" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" th:value="${route.routeId}" readonly="readonly">
                </div>
                <div class="layui-form-mid layui-word-aux">
                </div>
                <label for="routeUri" class="layui-form-label">
                    <span class="x-red">*</span>uri
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="routeUri" name="routeUri" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" th:value="${route.routeUri}" readonly="readonly">
                </div>
                <div class="layui-form-mid layui-word-aux">
                </div>
            </div>

            <div class="layui-form-item">
                <label for="routeOrder" class="layui-form-label">
                    排序
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="routeOrder" name="routeOrder" required="" lay-verify="number"
                           autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="routeOrder" class="layui-form-label">
                    元数据
                </label>
                <div class="layui-input-inline">
                    <textarea type="text" id="routeMetadata" name="routeMetadata" required=""
                              autocomplete="off" class="layui-textarea"></textarea>
                </div>
                <div class="layui-form-mid layui-word-aux">
                </div>
            </div>
        </form>
        <fieldset class="layui-elem-field layui-field-title">
            <legend>断言信息</legend>
        </fieldset>
        <fieldset class="layui-elem-field layui-field-title">
            <legend>过滤器信息</legend>
        </fieldset>
    </div>
</div>
<!--<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">-->
    <!--<legend>限流信息</legend>-->
<!--</fieldset>-->
</body>
<script>layui.use(['form', 'layer'],
    function() {
        $ = layui.jquery;
        var form = layui.form,
            layer = layui.layer;

        //自定义验证规则
        form.verify({
            nikename: function(value) {
                if (value.length < 5) {
                    return '昵称至少得5个字符啊';
                }
            },
            pass: [/(.+){6,12}$/, '密码必须6到12位'],
            repass: function(value) {
                if ($('#L_pass').val() != $('#L_repass').val()) {
                    return '两次密码不一致';
                }
            }
        });

        //监听提交
        form.on('submit(add)',
            function(data) {
                console.log(data);
                //发异步，把数据提交给php
                layer.alert("增加成功", {
                        icon: 6
                    },
                    function() {
                        //关闭当前frame
                        xadmin.close();

                        // 可以对父窗口进行刷新
                        xadmin.father_reload();
                    });
                return false;
            });

    });</script>
</html>